<?php
class Admin_Form_CreateAclResource extends Custom_Form
{
     private $_resource_id = '';
     
     function  __construct($resourceid = '') {
		$this->_resource_id = $resourceid;
		parent::__construct(null);
	}
     
    public function init()
    {
        $translator = Zend_Registry::get('translate');
        
        $this->setName("addresource");
        $this->setMethod('post');

        $this->addElement('text', 'resource_module', 
                               array('label' => $translator->_('Resource Module'), 
                              'required' => 'true',
                              'filters'=> array('StringTrim'),
                             
                             ));
        
        $this->addElement('text', 'resource', 
                               array('label' => $translator->_('Resource'), 
                              'required' => 'true',
                              'filters'=> array('StringTrim'),
                               'validators'=>array( array('Db_NoRecordExists',false,array('table'=>'viz_acl_resources','field'=>'resource','exclude'=>array('field'=>'id','value'=>$this->_resource_id))
                                ))));
        

    $this->addElement('submit', 'Submit', 
                                    array('ignore' => true,
                                         'required' => false,
                                          'lable'=>$translator->_('Register'),
                                        ));

        $element = $this->getElement('Submit');
        $element->removeDecorator('label');
     
        
    }
    
    
}
?>
